#ifndef DESKTOPPET_H
#define DESKTOPPET_H

#include <QWidget>
#include <QMovie>
#include <QTimer>
#include <QPoint>
#include <QRect>
#include <QPushButton>  // 添加按钮类

class DesktopPet : public QWidget
{
Q_OBJECT
public:
    explicit DesktopPet(QWidget* parent = nullptr); // 构造函数
    ~DesktopPet(); // 析构函数

protected:
    void paintEvent(QPaintEvent* event) override; // 重写绘制事件

    void mousePressEvent(QMouseEvent* event) override; // 鼠标按下事件
    void mouseMoveEvent(QMouseEvent* event) override; // 鼠标移动事件
    void mouseReleaseEvent(QMouseEvent* event) override; // 鼠标释放事件

private slots:
    void closePet(); // 关闭小宠物窗口

private:
    QMovie* movie = nullptr;     // GIF 动画对象
    QPoint dragPosition;         // 拖拽偏移
    QPushButton* closeButton;    // 关闭按钮
    int padding = 60;            // 额外的空白区域
};

#endif // DESKTOPPET_H
